<%@ page contentType="text/html" pageEncoding="UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<div class="box">
  <h2>Liste des utilisateurs</h2>
  <div class="box-content">
    <form method="post" action="#">
      <table cellspacing="0" cellpadding="0" id="list-of-users" class="dataview">
        <thead>
          <tr>
            <td><input type="checkbox" name="checkAll" value="0" /></td>
            <td><a href="#sort">Pseudo</a></td>
            <td><a href="#sort">Courriel</a></td>
            <td><a href="#sort">Solde</a></td>
            <td><a href="#sort">Adresse IP</a></td>
            <td><a href="#sort" title="Date de naissance">DDN</a></td>
            <td><a href="#sort" tilte="Date de création du compte">Création</a></td>
            <td><a href="#sort" tilte="Date de dernière mise à jour du compte">Mise à jour</a></td>
            <td><a href="#sort" tilte="Date de dernière connexion">Connexion</a></td>
            <td><a href="#sort">&nbsp;</a></td>
            <td><a href="#sort">&nbsp;</a></td>
          </tr>
        </thead>
        <tfoot>
          <tr>
            <td colspan="11">
              <ul class="list-of-actions">
                <li><a href="#ban">Bannir</a><span>|</span></li>
                <li><a href="#remove">Supprimer</a></li>
              </ul>
            </td>
          </tr>
        </tfoot>
        <tbody>
          <c:forEach items="${users}" var="u">
            <tr>
              <td>
                <c:choose>
                  <c:when test="${u.id == 1}">&nbsp;</c:when>
                  <c:otherwise><input type="checkbox" name="check" value="<c:out value="${u.id}"/>" /></c:otherwise>
                </c:choose>
              </td>
              <td>
                <c:choose>
                  <c:when test="${u.id == 1}"><c:out value="${u.login}"/></c:when>
                  <c:otherwise><a href="#user" rel="<c:out value="${u.id}"/>"><c:out value="${u.login}"/></a></c:otherwise>
                </c:choose>
              </td>
              <td><c:out value="${u.email}"/></td>
              <td><c:out value="${u.balance}"/></td>
              <td><c:out value="${u.ip}"/></td>
              <td><c:out value="${u.birthDateFormatted}"/></td>
              <td><span><c:out value="${u.creationTimeFormatted}"/></span></td>
              <td><span><c:out value="${u.lastModificationFormatted}"/></span></td>
              <td><span><c:out value="${u.lastConnectionFormatted}"/></span></td>
              <td>
                <div class="light 
                     <c:choose>
                       <c:when test="${u.status == 0}">red</c:when>
                       <c:when test="${u.status == 1}">orange</c:when>
                       <c:when test="${u.status == 2}">green</c:when>
                     </c:choose>">
                  <img alt="light" title="
                       <c:choose>
                         <c:when test="${u.status == 0}">Utilisateur banni</c:when>
                         <c:when test="${u.status == 1}">Utilisateur en attente de confirmation</c:when>
                         <c:when test="${u.status == 2}">Utilisateur confirmé</c:when>
                       </c:choose>
                       "
                       src="/img/adm/light.png">
                </div>
              </td>
              <td>
                <div class="light
                     <c:choose>
                       <c:when test="${u.paymentMethod.status == 0}">red</c:when>
                       <c:when test="${u.paymentMethod.status == 1}">orange</c:when>
                       <c:when test="${u.paymentMethod.status == 2}">orange</c:when>
                       <c:when test="${u.paymentMethod.status == 3}">green</c:when>
                     </c:choose>">
                  <img alt="light" title="
                       <c:choose>
                         <c:when test="${u.paymentMethod.status == 0}">Moyen de paiement refusé</c:when>
                         <c:when test="${u.paymentMethod.status == 1}">Moyen de paiement inactif</c:when>
                         <c:when test="${u.paymentMethod.status == 2}">Moyen de paiement en cours de vérification</c:when>
                         <c:when test="${u.paymentMethod.status == 3}">Moyen de paiement validé</c:when>
                       </c:choose>
                       "
                       src="/img/adm/light.png">
                </div>
              </td>
            </tr>
          </c:forEach>
        </tbody>
      </table>
    </form>
  </div>
</div>